package org.groupg.filetodb;

import org.apache.commons.csv.CSVRecord;

import java.util.List;

public class CsvBatchEvent {
    private List<CSVRecord> records;  // 使用commons-csv的CSVRecord
    private int batchNumber;

    public List<CSVRecord> getRecords() {
        return records;
    }

    public void setRecords(List<CSVRecord> records) {
        this.records = records;
    }

    public int getBatchNumber() {
        return batchNumber;
    }

    public void setBatchNumber(int batchNumber) {
        this.batchNumber = batchNumber;
    }

    // getters & setters
    public void clear() {
        records = null;
        batchNumber = 0;
    }

    public String[][] getRecordsArray(){
        int rows = records.size();
        int columns = records.get(0).size();
        String[][] recordsArray = new String[rows][columns];
        for(int i=0;i<rows;i++){
            for(int j=0;j<columns;j++){
                recordsArray[i][j]= records.get(i).get(j);
            }
        }
        return recordsArray;
    }
}
